//
//  StateViewer.h
//  YuchBox
//
//  Created by Ivan on 11-11-11.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

@class StateViewer;

typedef enum{
    StateEventNone      = -1,
    StateEventOnline    = 0,
    StateEventOffline   = 2, 
} StateEvent;

typedef enum {
    StateMessageNone         = -1,
    StateMessageNoNewMessage = 0,
    StateMessageNewMessage,
} StateMessage;

typedef enum {
    StateImageIndexOnline = 0,          // StateEventOnline + StateMessageNoNewMessage
    StateImageIndexOnlineNewMsg,        // StateEventOnline + StateMessageNewMessage
    StateImageIndexOffline,             // StateEventOffline + StateMessageNoNewMessage 
    StateImageIndexOfflineNewMsg,       // StateEventOffline + StateMessageNewMessage
} StateImageIndex;


@protocol StateViewerDelegate

- (void)stateViewerSetup:(StateViewer *)stateViewer;
- (void)stateViewerUnsetup:(StateViewer *)stateViewer;

@end

//#define STATE_VIEWER [StateViewer sharedStateViewer]
@interface StateViewer : UIView
{
    NSInteger       _currentStateEvent;
    NSInteger       _currentStateMessage;
    NSArray         *_stateImages;
    UIImageView     *_imageView;
    UIButton        *_button;
    
    NSTimeInterval  _timeInterval;
}
@property (retain, nonatomic)   UIButton    *button;
@property (readonly, nonatomic) NSInteger   currentStateEvent;
//+ (StateViewer *)sharedStateViewer;
- (id)initSingleton;

- (id)initWithOrigin:(CGPoint)origin;

- (void)setTemporaryHide:(Boolean)isHidden delegate:(NSObject<StateViewerDelegate> *)delegate;
- (void)setOrigin:(CGPoint)origin delegate:(NSObject<StateViewerDelegate> *)delegate;
- (void)setStateEvent:(StateEvent)stateEvent;
- (void)setStateMessage:(StateMessage)stateMessage;
- (void)setStateImageIndex:(StateImageIndex)stateImageIndex animated:(Boolean)animated;
//- (void)setState:(StateEvent)state animated:(Boolean)animated delegate:(NSObject<StateViewerDelegate> *)delegate;
@end